using System;
using System.Collections.Generic;
using System.Text;

namespace MspEmulator
{
    static class Config
    {
        private static ushort expTime;
        private static ushort measureTime;
        private static ushort ionizatinVoltage;
        private static ushort CPVoltage;
        private static ushort heatCurrent;
        private static ushort emissionCurrent;
        private static ushort focusVoltage1;
        private static ushort focusVoltage2;

        public static ushort eTime
        {
            get { return expTime; }
            set { expTime = value; }
        }
        public static ushort mTime
        {
            get { return measureTime; }
            set { measureTime = value; }
        }

        public static ushort iVoltage
        {
            get { return ionizatinVoltage; }
            set { ionizatinVoltage = value; }
        }

        public static ushort CP
        {
            get { return CPVoltage; }
            set { CPVoltage = value; }
        }

        public static ushort hCurrent
        {
            get { return heatCurrent; }
            set { heatCurrent = value; }
        }
        public static ushort eCurrent
        {
            get { return emissionCurrent; }
            set { emissionCurrent = value; }
        }

        public static ushort fV1
        {
            get { return focusVoltage1; }
            set { focusVoltage1 = value; }
        }
        public static ushort fV2
        {
            get { return focusVoltage2; }
            set { focusVoltage2 = value; }
        }

        public static ushort scanVoltage(ushort step)
        {
            if (step > 1056) step = 1056;
            return Convert.ToUInt16(4096 * Math.Pow(((double)527 / (double)528), step));
        }

        public static ushort eTimeIntervals()
        {
            return (ushort)(eTime / 5);
        }

        public static ushort mTimeIntervals()
        {
            return (ushort)(mTime / 5);
        }
    }
}
